#!/bin/bash
#set -x
export ii=$II
export i=$I
export svn_verbose=0
if [[ "$1" = "-v" ]] ; then
	export svn_verbose=1
	shift 1
fi
export lsvn_loc=
if [[ "$1" = "-l" ]] ; then
	export lsvn_loc=$2
	shift 2
fi
if [[ "$1" = "-r" ]] ; then
  shift 2
fi
dir="$1"
fn="$2"
msg="$3"
bdir="$(basename $dir)"
if [[ -z "$msg" ]] ; then
  echo "No log msg" >&2
  exit 1
fi
#set -x
if [[ -n "$lsvn_loc" ]] ; then
	export SVN_LOC=$lsvn_loc
elif [[ -z "$SVN_LOC" ]] ; then
	export SVN_LOC=$CVS_LOC
fi
cd $dir
if [[ "$bdir" = "vim-bash-hacks" ]] ; then
	userparm="--username ib4coding"
	passparm="--password $ib4coding_pass"
else
	userparm="--username ibuntonjr"
	passparm="--password $ibuntonjr_pass"
fi
if (( svn_verbose == 1 )) ; then
	echo "$SVN_LOC/svn commit -m \"$msg\" $userparm $passparm $fn 2>&1 | tee -a $ii/whycmtl"
fi
$SVN_LOC/svn commit -m "$msg" $userparm $passparm $fn 2>&1 | tee -a $ii/whycmtl
#cvs admin -kb $fn
